package org.reborn.engine.input

object Input{
  
  private var mouseInput:Option[Mouse] = None
  private var keyboardInput:Option[Keyboard] = None
  
  def mouse_=(mouse:Mouse):Unit = {mouseInput = Option(mouse)}
  def mouse:Mouse = {mouseInput.getOrElse(null)}
  def getMouse:Option[Mouse] = mouseInput
  
  def keyboard_=(keyboard:Keyboard):Unit = {keyboardInput = Option(keyboard)}
  def keyboard:Keyboard = {keyboardInput.getOrElse(null)}
  def getKeyboard:Option[Keyboard] = keyboardInput
  
  def updateInputDevices = {
	val devices:List[Option[InputDevice]] = List(mouseInput,keyboardInput)
	
	for(deviceOpt <- devices; device <- deviceOpt){
	  device.poll
	}
  }
}


